

#include "atomic_op_namespace.h"

#include <sys/atomic.h>

void
atomic_inc_32(volatile uint32_t *addr)
{
	uint32_t old, new;

	do {
		old = *addr;
		new = old + 1;
	} while (atomic_cas_32(addr, old, new) != old);
}

#undef atomic_inc_32
atomic_op_alias(atomic_inc_32,_atomic_inc_32)

#undef atomic_inc_uint
atomic_op_alias(atomic_inc_uint,_atomic_inc_32)
__strong_alias(_atomic_inc_uint,_atomic_inc_32)

#if !defined(_LP64)
#undef atomic_inc_ulong
atomic_op_alias(atomic_inc_ulong,_atomic_inc_32)
__strong_alias(_atomic_inc_ulong,_atomic_inc_32)

#undef atomic_inc_ptr
atomic_op_alias(atomic_inc_ptr,_atomic_inc_32)
__strong_alias(_atomic_inc_ptr,_atomic_inc_32)
#endif /* _LP64 */
